package com.pomr.controller.message;

import com.pomr.model.sys.MsgContent;
import com.pomr.model.sys.User;
import com.pomr.service.message.MessageService;
import com.pomr.util.common.JWT;
import com.pomr.util.page.Page;
import com.pomr.util.page.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @作者：Administrator
 * @时间：13:36 2018/8/28 0028
 * @用途：
 **/
@Controller
@RequestMapping("/message")
public class MessageController {
    @Autowired
    @Qualifier("messageServiceImpl")
    private MessageService messageService;

    /**
     * 获取消息列表
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/inter-searchMsgOfAgency", method = RequestMethod.GET)
    @ResponseBody
    public Page<List<MsgContent>> searchMsgOfAgency(HttpServletRequest request, PageParam param) throws Exception{
        User user = JWT.findUserByToken(request);
        return messageService.searchMsgOfAgency(user, param);
    }


}
